#ifndef TCP_CLIENT_H
#define TCP_CLIENT_H

#include <cstdint>
#include <cstring>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <unistd.h>

namespace OHOS {
namespace DistributedHardware {
int TcpConnectSocket(const char* ip, uint16_t port);

class TcpClient {
public:
    TcpClient();
    ~TcpClient();

    int TcpConnectSocket(const char* ip, uint16_t port);
    bool SetSession(const char* svr_ip, uint16_t svr_port);
    void SetSession(int sock);
    int RecvData(char* buff, size_t size);
    int SendData(char* buff, size_t size);
    void CloseSocket();

private:
    int sock_;
};
}
}
#endif